from langchain.chat_models import ChatOpenAI
from langchain.prompts import (
    ChatPromptTemplate,
    SystemMessagePromptTemplate,
    HumanMessagePromptTemplate,
)
from langchain import LLMChain
from langchain_core.output_parsers import StrOutputParser

chat = ChatOpenAI(temperature=0)

template = (
    "You are a helpful assistant that translates {input_language} to "
    "{output_language} ."
)
system_message_prompt = SystemMessagePromptTemplate.from_template(template)

human_template = "{text}"
human_message_prompt = HumanMessagePromptTemplate.from_template(human_template)

chat_prompt = ChatPromptTemplate.from_messages([
    system_message_prompt,
    human_message_prompt
])

parser = StrOutputParser()

chain = LLMChain(llm=chat, prompt=chat_prompt)

result = chain.invoke({
    "input_language": "English",
    "output_language": "French",
    "text": "I love programming"
})

print(result)